package org.tgcloud.group.repository;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.tgcloud.group.entity.MjBusinessAccount;
import org.tgcloud.group.web.controller.dto.businessAccount.AccountCountAreaListDTO;
import org.tgcloud.group.web.controller.dto.businessAccount.AccountCountDTO;
import org.tgcloud.group.web.controller.dto.businessAccount.BusinessAccountListDTO;
import org.tgcloud.group.web.controller.dto.businessAccount.BusinessAccountProtectDTO;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @Author: zhy
 * @Created: 2024-07-30-下午5:19
 * @Description: ${description}
 */
@Mapper
public interface MjBusinessAccountMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(MjBusinessAccount record);

    int insertSelective(MjBusinessAccount record);

    MjBusinessAccount selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(MjBusinessAccount record);

    int updateByPrimaryKey(MjBusinessAccount record);

    List<BusinessAccountListDTO> selectManageList(@Param("keyword") String keyword, @Param("startTime") Date startTime, @Param("endTime") Date endTime,
                                                  @Param("businessId") Integer businessId, @Param("customerStatus") Integer customerStatus,
                                                  @Param("customerStage") Integer customerStage, @Param("customerType") Integer customerType,
                                                  @Param("customerProductType") Integer customerProductType, @Param("customerLevel") Integer customerLevel,
                                                  @Param("customerSource") Integer customerSource, @Param("departId") Integer departId,
                                                  @Param("lastFollowStartTime") Date lastFollowStartTime, @Param("lastFollowEndTime") Date lastFollowEndTime,
                                                  @Param("areaId") Integer areaId, @Param("businessType") Short businessType,
                                                  @Param("followStartTime") Date followStartTime, @Param("followEndTime") Date followEndTime,
                                                  @Param("checkStartTime") Date checkStartTime, @Param("checkEndTime") Date checkEndTime,
                                                  @Param("hasCheck") Boolean hasCheck, @Param("province") String province, @Param("city") String city,
                                                  @Param("protectStartTime") Date protectStartTime, @Param("protectEndTime") Date protectEndTime,
                                                  @Param("hasProtect") Boolean hasProtect, @Param("hasNoProtect") Boolean hasNoProtect,
                                                  @Param("hasCooperate") Boolean hasCooperate, @Param("hasConnect") Boolean hasConnect,
                                                  @Param("hasOnlyBusiness") Boolean hasOnlyBusiness, @Param("userId") Integer userId,
                                                  @Param("protectTypeList") List protectTypeList, @Param("accurateSearchKeyword") String accurateSearchKeyword);

    MjBusinessAccount selectHasAddByBrandsNameAndNoBrandId(@Param("brandsName") String brandsName, @Param("businessId") Integer businessId);

    MjBusinessAccount selectHasAddByBrandsNameToAddProject(@Param("brandsName") String brandsName, @Param("businessId") Integer businessId);

    MjBusinessAccount selectHasGetAddByBrandsName(@Param("brandsName") String brandsName);

    MjBusinessAccount selectHasAddByBrandsNameAndBrandId(@Param("brandsName") String brandsName, @Param("businessId") Integer businessId);

    int updateStatusById(@Param("businessAccountId") Integer businessAccountId, @Param("status") short status);

    BusinessAccountListDTO selectManageMsgById(@Param("id") Integer businessAccountId);

    int updateLastFollowTimeById(@Param("id") Integer businessAccountId);

    List<AccountCountDTO> selectAddNumByTimeGroupByDepart(@Param("startTime") Date startTime, @Param("endTime") Date endTime);

    List<AccountCountDTO> selectAddNumByTimeGroupByArea(@Param("startTime") Date startTime, @Param("endTime") Date endTime);

    MjBusinessAccount selectHasAddById(@Param("businessId") Integer businessId);

    List<AccountCountDTO> selectAddSignOrderByTimeGroupByDepart(@Param("startTime") Date startTime, @Param("endTime") Date endTime);

    List<AccountCountDTO> selectAddSignOrderByTimeGroupByArea(@Param("startTime") Date startTime, @Param("endTime") Date endTime);

    List<AccountCountDTO> selectAllAddSignOrderNumGroupByDepart();

    List<AccountCountDTO> selectAllAddSignOrderNumGroupByArea();

    int selectAllNum();

    List<AccountCountAreaListDTO> selectAllNumByTimeGroupByArea(@Param("startTime") Date startTime, @Param("endTime") Date endTime);

    BusinessAccountProtectDTO selectAccountProtectNumByTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime);

    List<MjBusinessAccount> selectTaskList();

    List<AccountCountAreaListDTO> selectAllNumByTimeGroupByCity(@Param("startTime") Date startTime, @Param("endTime") Date endTime);

    List<MjBusinessAccount> selectAllList();

    int updateTest();

    List<Map> selectTestList();

    MjBusinessAccount selectTestProtectMsgById(@Param("director_ids") String director_ids, @Param("brands_name") String brands_name);

    int updateBusinessByBusinessId(@Param("businessIdList") String[] ids,
                                   @Param("businessUserId") Integer businessUserId);

    int updateBusinessById(@Param("businessIdList") String[] ids,
                           @Param("businessUserId") Integer businessUserId);

    List<MjBusinessAccount> selectTestListByNullOrderTime();

    int updateOrderTimeById(@Param("id") Integer id, @Param("orderTime") Date orderTime);

    List<MjBusinessAccount> selectTestListByIds(@Param("split") String[] split);
}